package model;

import java.awt.Color;
import java.util.ArrayList;

/**
 * Keeps anchor points in a list
 * @author	Daniel Mohr, Daniela Grammlich
 */
public class AnchorPointManager {
	
	/**
	 * Holds the anchor points
	 */
	ArrayList<AnchorPoint> anchorList;
	/**
	 * The color of the anchor point
	 */
	Color color = new Color(255, 0, 0);
	
	public AnchorPointManager() {
		anchorList = new ArrayList<AnchorPoint>();
	}
	
	/**
	 * Creates an anchor point and adds it to the list
	 * @param x	The x position
	 * @param y The y position
	 * @param gridNumber The number of the grid
	 */
	public void createAnchorPoint(int x, int y, int gridNumber) {
		AnchorPoint anchorPoint = new AnchorPoint(x, y, gridNumber);
		anchorPoint.setColor(color);
		addAnchorPoint(anchorPoint);
	}
	
	/**
	 * Adds an anchor point to the list
	 * @param anchorPoint
	 */
	public void addAnchorPoint(AnchorPoint anchorPoint) {
		anchorList.add(anchorPoint.getID(), anchorPoint);
	}
	
	/**
	 * Deletes all anchor points from the list
	 */
	public void deleteAnchorPoints(){
		anchorList.clear();
	}
	
	/**
	 * @return the anchorList
	 */
	public ArrayList<AnchorPoint> getAnchorList() {
		return anchorList;
	}
	
	/**
	 * @param anchorList the anchorList to set
	 */
	public void setAnchorList(ArrayList<AnchorPoint> anchorList) {
		this.anchorList = anchorList;
	}
	
	/**
	 * @return the color
	 */
	public Color getColor(){
		return color;
	}
	
	/**
	 * @return the anchor point list
	 */
	public ArrayList<AnchorPoint> getCurrentAnchorPointList() {
		return anchorList;
	}
	
}